export function scroll (parent, child, timer, tabClicked = null) {
  let scrollBar = document.querySelector(`.${parent}`);
  let targetTop = (document.querySelector(`.${child}`) as HTMLElement).offsetTop;
  let clientHeight = (scrollBar as HTMLElement).clientHeight;
  let scrollHeight = (scrollBar as HTMLElement).scrollHeight;
  clearInterval(timer);
  (scrollBar as HTMLElement).onmousewheel = function () {
    clearInterval(timer);
  }
  return timer = setInterval(() => {
    let speed = (targetTop - scrollBar.scrollTop) / 10;
    speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
    scrollBar.scrollTop += speed;
    if(scrollBar.scrollTop === targetTop || scrollBar.scrollTop + clientHeight === scrollHeight) {
      clearInterval(timer);
    }
  }, 30)
}